<#macro pages>
<#assign pageNo=page.getPageNo()?default('1') />
<form id="filterPageForm" name="filterPageForm" method="post" action="${request.getRequestURL()}" onsubmit="return checkForm()">
<input name="page.pageNo" id="page.pageNo" value="${pageNo}" type="hidden" />
<#list request.getParameterNames() as list>
<#if list!='page.pageNo'>
	<input type="hidden" name="${list}" id="${list}" value="${request.getParameter("${list}")}"/>
	</#if>
</#list>
</form>
<script language="javascript">
    function filterPageForm_submit(page){
    	if(page){
    	document.getElementById("page.pageNo").value=page;
    	}
	    document.filterPageForm.submit();
    }
</script>
第${pageNo}页, 共${page.getTotalPages()?default('')}页 
		<a href="javascript:filterPageForm_submit(1);">首页</a>
		<#if (pageNo?number-3>0)>
			...&nbsp;
		</#if>
		<#if (pageNo?number-2>0)>
			<a href="javascript:filterPageForm_submit(${pageNo-2});">${pageNo?default('0')?number-2}</a>&nbsp;
		</#if>
		<#if (pageNo?number-1>0)>
			<a href="javascript:filterPageForm_submit(${pageNo-1});">${pageNo-1}</a>&nbsp;
		</#if>
		<#if (pageNo?number>0)>
			${pageNo}&nbsp;
		</#if>
		<#if (page.getTotalPages()?default('0')?number>=pageNo?number+1)>
			<a href="javascript:filterPageForm_submit(${pageNo+1});">${pageNo+1}</a>&nbsp;
		</#if>
		<#if (page.getTotalPages()?default('0')?number>=pageNo?number+2)>
			<a href="javascript:filterPageForm_submit(${pageNo+2});">${pageNo+2}</a>&nbsp;
		</#if>
		<#if (page.getTotalPages()?default('0')?number>=pageNo?number+3)>
			<a href="javascript:filterPageForm_submit(${pageNo+3});">${pageNo+3}</a>&nbsp;
		</#if>
		<#if (page.getTotalPages()?default('0')?number>=pageNo?number+4)>
			<a href="javascript:filterPageForm_submit(${pageNo+4});">${pageNo+4}</a>&nbsp;
		</#if>
		<#if (page.getTotalPages()?default('0')?number>=pageNo?number+5)>
			...&nbsp;
		</#if>
		<a href="javascript:filterPageForm_submit(${page.getTotalPages()});" >末页</a>
</#macro>
<#-- 用于分页的宏，URL为可选参数。不传URL，则取当前URL值。 -->
<#macro goolepages url>
<#assign pageNo=page.getPageNo()?default('1') />
<form id="filterPageForm" name="filterPageForm" method="post" action="${url}" onsubmit="return checkForm()">
<input name="page.pageNo" id="page.pageNo" value="${pageNo}" type="hidden" />
<#-- 获取所有页面参数 -->
<#list request.getParameterNames() as list>
<#if list!='page.pageNo'>
    <input type="hidden" name="${list}" id="$key" value="${request.getParameter("${list}")}"/>
</#if>
</#list>
</form>
<script language="javascript">
  function filterPageForm_submit(page){
    if(page){
    	document.getElementById("page.pageNo").value=page;
    }
        document.filterPageForm.submit();
   }

</script>
<#-- number将字符串转换为数字 -->
       <#if (pageNo?number>1)>
           <a href="javascript:filterPageForm_submit(${pageNo-1});">上一页</a>
       </#if>
       <#if (pageNo?number-3>0)>
           <a href="javascript:filterPageForm_submit(${pageNo-3});">${pageNo-3}</a>
       </#if>
       <#if (pageNo?number-2>0)>
           <a href="javascript:filterPageForm_submit(${pageNo-2});">${pageNo-2}</a>
       </#if>
       <#if (pageNo?number-1>0)>
           <a href="javascript:filterPageForm_submit(${pageNo-1});">${pageNo-1}</a>
       </#if>
       <#if (pageNo?number>0)>
           <font color="red">${pageNo}</font>
       </#if>
       <#if (page.getTotalPages()?default('0')?number>=pageNo?number+1)>
           <a href="javascript:filterPageForm_submit(${pageNo+1});">${pageNo+1}</a>
       </#if>
       <#if (page.getTotalPages()?default('0')?number>=pageNo?number+2)>
           <a href="javascript:filterPageForm_submit(${pageNo+2});">${pageNo+2}</a>
       </#if>
       <#if (page.getTotalPages()?default('0')?number>=pageNo?number+3)>
           <a href="javascript:filterPageForm_submit(${pageNo+3});">${pageNo+3}</a>
       </#if>
       <#if (page.getTotalPages()?default('0')?number>=pageNo?number+1)>
           <a href="javascript:filterPageForm_submit(${pageNo+1});">下一页</a>
       </#if>
</#macro>
<#-- 导出报表 -->
<#macro export path>
<#assign pageNo=page.getPageNo()?default('1') />
<form id="exportForm" name="exportForm" method="post" action="" onsubmit="return checkForm()">
<input name="page.pageNo" id="page.pageNo" value="${pageNo}" type="hidden" />
<#list request.getParameterNames() as list>
<#if list!='page.pageNo'>
	<input type="hidden" name="${list}" id="${list}" value="${request.getParameter("${list}")}"/>
	</#if>
</#list>
</form>
<script language="javascript">
    function exportExcel(){
    	document.exportForm.action="${base}/${path}/excel.shtml";
    	document.exportForm.submit();
    }
    function exportPDF(){
    	document.exportForm.action="${base}/${path}/pdf.shtml";
    	document.exportForm.submit();
    }
</script>
<a href="javascript:exportExcel()">EXCEL</a>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:exportPDF()">PDF</a>
</#macro>

